//  权限
import router from './router/router'
import store from './store'
import {getToken} from '@/util/auth'
import {
	asyncRouterMap
} from '@/router/router'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
// NProgress.configure({
//   showSpinner: false
// }) // NProgress Configuration
router.addRoutes(asyncRouterMap);
const lockPage = '/lock';
router.beforeEach((to, from, next) => {
	NProgress.start();
	console.log(to,store.getters.isLock)
	store.commit('Add_Tabs',{name:to.path,title:to.name});
	if(store.getters.isLock && to.path != lockPage){
		next({path:lockPage});
		NProgress.done();
		return ;
	}else{
	    next();
	    NProgress.done();
	}
	// else if(to.path !== '/login'){
	// 	console.log(111)
	// 	next();
	// 	NProgress.done();
	// }
})
// router.afterEach((to, from) => {
  
// })